@section('css')
    <link rel="stylesheet" href="{{ asset('plugins/upload/imgUpload.css')}}">
@stop
<div class="form-group">
    <label for="tag" class="col-md-3 control-label">奖品名称</label>
    <div class="col-md-6">
        <input type="text" class="form-control" name="name" id="tag" value="{{ $name }}" autofocus>
    </div>
</div>
<div class="form-group">
    <label for="tag" class="col-md-3 control-label">属于等级</label>
    <div class="col-md-6">
        <select name="rank_id" class="form-control">
            <option value="">==属于等级==</option>
            @foreach($rankAll as $row)
              <option value="{{$row->id}}" @if($row->id == $rank_id) selected @endif>{{$row->name}}</option>
            @endforeach
        </select>
    </div>
</div>

<div class="form-group">
    <label for="tag" class="col-md-3 control-label">奖品数量</label>
    <div class="col-md-6">
        <input type="text" class="form-control" name="count" id="tag" value="{{ $count }}" autofocus>
    </div>
</div>

<div class="form-group">
    <label for="tag" class="col-md-3 control-label">红包金额</label>
    <div class="col-md-6">
        <input type="text" class="form-control" name="cash" id="tag" value="{{ $cash }}" autofocus>
    </div>
</div>


<div class="form-group">
    <label for="tag" class="col-md-3 control-label">上传图片</label>
    <div class="col-md-7 thumb-wrap">
        <div class="uploader col-md-6 orange">
            <input type="text" class="filename" id="img_url1" value="{{$imgUrl}}"  readonly/>
            <input type="hidden" name="attach_id" class="attach_id" value="{{$attach_id}}">
            <input type="button"  class="button" value=" 上传图片... "/>
            <input type="file"  id="upload_imgUrl" class="form-control"  multiple="multiple"  />
        </div>
    </div>
</div>
<div class="form-group">
    <label for="tag" class="col-md-3 control-label"></label>
    <div class="col-md-5">
        <img src="{{$imgUrl}}" id="imgUrl" @if($imgUrl) height='120px' @endif>
    </div>
</div>

<div class="form-group">
    <label for="tag" class="col-md-3 control-label">奖品概率</label>
    <div class="col-md-6">
        <input type="text" class="form-control" name="chance" id="tag" value="{{ $chance }}" autofocus>
    </div>
</div>

<div class="form-group">
    <label for="tag" class="col-md-3 control-label">兑换密码</label>
    <div class="col-md-6">
        <input type="text" class="form-control" name="passwd" id="tag" value="{{ $passwd }}" autofocus>
    </div>
</div>

<div class="form-group">
    <label for="tag" class="col-md-3 control-label">简介</label>
    <div class="col-md-4">
        <div class="editor">
            <textarea id='myEditor' name="info">{{$info}}</textarea>
        </div>
    </div>
</div>

@section('js')
    <script src="{{ asset('plugins/upload/upload/mobileFix.mini.js')}}"></script>
    <script src="{{ asset('plugins/upload/upload/exif.js')}}"></script>
    <script src="{{ asset('plugins/upload/upload/lrz.js')}}"></script>
    <script type="text/javascript">
        $("#upload_imgUrl").change(function(){
            var file_div = $(this).val();
            var token = "{{ csrf_token() }}";
            for( var i=0;i<this.files.length;i++)
                lrz(this.files[i],{},function(result){
                    if(file_div){
                        $.ajax({
                            type:'POST',
                            url:"{{url('tool/upload/uploadImg')}}",
                            enctype: 'multipart/form-data',
                            dataType:'JSON',
                            data:{_token:token,base64:result.base64,filename:result.origin.name,size:result.base64.length},
                            beforeSend:function(){
                            },
                            success:function(data){
                                if(data.success == true){
                                    $('#img_url1').val(data.url);
                                    $('.attach_id').val(data.id);
                                    $("#imgUrl").attr('src',data.url);
                                    $("#imgUrl").css('height','120px');
                                }
                            }
                        });
                    }
                });
        });
    </script>
    @include('editor::head')
    @include('editor::decode')
    @stop




